from sanic import Blueprint
from sanic.response import json


login_blu = Blueprint(__name__)


@login_blu.route("/user", methods=["POST"])
async def index(request):
    redisobj = await get_redis_obj()

    banner = await redisobj.get("index_banner")
    r_list = await redisobj.get("r_index_list")
    l_list = await redisobj.get("l_index_list")

    banner = banner.decode()
    r_list = r_list.decode()
    l_list = l_list.decode()

    data = {"r_list": r_list, "l_list": l_list, "banner": banner}
    return json({"code": 0, "msg": "请求成功", "data": data})

